<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="admin_header.jsp"/>
<!-- 主内容区 -->
<main role="main" class="col-md-10 ml-sm-auto px-4">
    <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
        <h1 class="h2">添加新闻</h1>
    </div>

    <form action="newsAdd" method="post" enctype="multipart/form-data">
        <div class="mb-3">
            <label for="title" class="form-label">新闻标题</label>
            <input type="text" class="form-control" id="title" name="title" required>
        </div>

        <div class="mb-3">
            <label for="sort_id" class="form-label">新闻分类</label>
            <select class="form-control" id="sort_id" name="sort_id" required>
                <option value="">请选择分类</option>
                <c:forEach items="${sortList}" var="sort">
                    <option value="${sort.sort_id}">${sort.name}</option>
                </c:forEach>
            </select>
        </div>

        <div class="mb-3">
            <label for="content" class="form-label">新闻内容</label>
            <textarea class="form-control" id="content" name="content" rows="10" required></textarea>
        </div>

        <div class="mb-3">
            <label for="image" class="form-label">新闻图片</label>
            <input type="file" class="form-control" id="image" name="image" accept="image/*">
        </div>

        <button type="submit" class="btn btn-danger">保存</button>
        <a href="newsManage" class="btn btn-secondary">返回</a>
    </form>
</main>
</body>
</html> 